package com.encryption.framework.logic
{
	import mx.containers.ViewStack;

	public class DisplayStateManager
	{
		private static var _instance:DisplayStateManager = new DisplayStateManager();
		
		private var _currentState:String = "";
		private var _backState:String = "";
		private var _forwordState:String = "";
		private var _stateArray:Array = [];
		
		private static var _rootViewStack:ViewStack;
		
		public function DisplayStateManager()
		{
		}
		
		public static function get instance():DisplayStateManager
		{
			return _instance;
		}
		
		public static function setRootViewStack(viewStack:ViewStack):void
		{
			_rootViewStack = viewStack;
		}
		
		public function backState():void
		{
			
		}
		
		public function forwordState():void
		{
			
		}
		
		public function get currentState():String
		{
			return _currentState;
		}
		
		public function set currentState(value:String):void
		{
			_currentState = value;
		}
		
		public function goToState(state:String):void
		{
			if(_rootViewStack == null)
				return;
			
			var index:int = _stateArray.indexOf(state);
			if(index != -1){
				_rootViewStack.selectedIndex = index;
			}
		}
		
		public function registerState(state:String):void{
			_stateArray.push(state);
		}
		
	}
}